package com.example.wlzz.controller;
import com.example.wlzz.service.UserInfoService;
import com.example.wlzz.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/userInfoControl")
@Slf4j
@Api(tags = "用户修改个人信息模块")
public class UserInfoController {
    @Autowired
    private UserInfoService userInfoService;
    @PostMapping("/alterNickName")
    @ApiOperation("修改昵称")
    public ResultVO alterNickName(@ApiParam("token凭据") @RequestParam("token") String token,
                                  @ApiParam("需要修改的昵称") @RequestParam("nickName") String nickName){
        return  userInfoService.alterNickName(nickName,token);
    }
    @PostMapping("/alterRealName")
    @ApiOperation("修改真实姓名")
    public ResultVO alterRealName(@ApiParam("token凭据") @RequestParam("token") String token,
                                  @ApiParam("需要修改的真实姓名") @RequestParam("realName") String realName){
        return  userInfoService.alterRealName(realName,token);
    }
    @PostMapping("/alterSex")
    @ApiOperation("修改性别")
    public ResultVO alterSex(@ApiParam("token凭据") @RequestParam("token") String token,
                             @ApiParam("需要修改的性别") @RequestParam("sex") String sex){
        return  userInfoService.alterSex(sex,token);
    }
    @PostMapping("/alterBirth")
    @ApiOperation("修改生日")
    public ResultVO alterBirth(@ApiParam("token凭据") @RequestParam("token") String token,
                               @ApiParam("需要修改的生日(日期格式如：yyyy-MM-dd HH:mm:ss)") @RequestParam("birth") String birth){
        return  userInfoService.alterBirth(birth,token);
    }
    @PostMapping("/alterMotto")
    @ApiOperation("修改座右铭")
    public ResultVO alterMotto(@ApiParam("token凭据") @RequestParam("token") String token,
                               @ApiParam("座右铭") @RequestParam("motto") String motto){
        return  userInfoService.alterMotto(motto,token);
    }
    @PostMapping("/alterSchoolName")
    @ApiOperation("修改学校名称")
    public ResultVO alterSchoolName(@ApiParam("token凭据") @RequestParam("token") String token,
                               @ApiParam("学校名称") @RequestParam("schoolName") String schoolName){
        return  userInfoService.alterSchoolName(schoolName,token);
    }
    @PostMapping("/alterDepartmentName")
    @ApiOperation("修改院系")
    public ResultVO alterDepartmentName(@ApiParam("token凭据") @RequestParam("token") String token,
                                    @ApiParam("院系") @RequestParam("department") String department){
        return  userInfoService.alterDepartmentName(department,token);
    }
    @PostMapping("/alterMajorName")
    @ApiOperation("修改专业")
    public ResultVO alterMajorName(@ApiParam("token凭据") @RequestParam("token") String token,
                                        @ApiParam("专业") @RequestParam("majorName") String majorName){
        return  userInfoService.alterMajorName(majorName,token);
    }
    @PostMapping("/alterSno")
    @ApiOperation("修改学号")
    public ResultVO alterSno(@ApiParam("token凭据") @RequestParam("token") String token,
                                   @ApiParam("教务系统的学号") @RequestParam("sno") String sno){
        return  userInfoService.alterSno(sno,token);
    }
    @PostMapping("/alterSnoPassword")
    @ApiOperation("修改教务系统学号的密码")
    public ResultVO alterSnoPassword(@ApiParam("token凭据") @RequestParam("token") String token,
                             @ApiParam("教务系统学号的密码") @RequestParam("snoPassword") String snoPassword){
        return  userInfoService.alterSnoPassword(snoPassword,token);
    }
    @PostMapping("/alterImgUrl")
    @ApiOperation("修改头像")
    public ResultVO alterImgUrl(@ApiParam("token凭据") @RequestParam("token") String token,
                                     @ApiParam("头像路径") @RequestParam("imgUrl") String imgUrl){
        return  userInfoService.alterImgUrl(imgUrl,token);
    }

}
